package com.sh.production;

import com.sh.bean.CommonInformationItem;
import com.sh.bean.RssNewsBuffer;
import com.sh.utils.RssDataGrab;
import org.apache.log4j.Logger;

import java.util.List;

public class NewsProductTask implements Runnable {
    private static Logger log = Logger.getLogger(NewsProductTask.class.getName());
    private String name;
    private String url;
    private RssNewsBuffer buffer;


    public NewsProductTask(String name, String url, RssNewsBuffer buffer) {
        this.name = name;
        this.url = url;
        this.buffer = buffer;
    }

    @Override
    public void run() {
      RssDataGrab capturer = new RssDataGrab(name);
        List<CommonInformationItem> list = capturer.load(url);
        for (CommonInformationItem item : list) {
            buffer.add(item);
        }

    }
}
